import logging
from redis import StrictRedis


class Config(object):
    LOG_LEVEL = logging.DEBUG
    # 加密钥匙
    SECRET_KEY = 'KZtgoZECnZyp/hiU49YHotf2Nv4IGYqF5I7M6K3iClzvTWYtALha9E2i7wgIK78X'
    # DEBUG = True
    # 配置数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/infomation'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # redis服务器
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 设置Session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=1)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = True


class DevelopmentConfig(Config):

    DEBUG = True


class ProductionConfig(Config):
    LOG_LEVEL = logging.ERROR
    DEBUG = False

config={
    "development":DevelopmentConfig,
    "production":ProductionConfig
}